using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._RasterAnalysisTools._Generalize
{
    /// <summary>
    /// <para>Nibble</para>
    /// <para>Replaces cells of a raster corresponding to a mask with the values of the nearest neighbors.</para>
    /// <para>将与蒙版对应的栅格像元替换为最近邻的值。</para>
    /// </summary>    
    [DisplayName("Nibble")]
    public class Nibble : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public Nibble()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_inputRaster">
        /// <para>Input Raster</para>
        /// <para><xdoc>
        ///   <para>The input raster that will be nibbled.</para>
        ///   <para>The raster can be either integer or floating point type.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将被蚕食的输入栅格。</para>
        ///   <para>栅格可以是整数类型，也可以是浮点类型。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_inputMaskRaster">
        /// <para>Input Mask Raster</para>
        /// <para><xdoc>
        ///   <para>The raster used as the mask.</para>
        ///   <para>The cells that are NoData define the cells that will be nibbled, or replaced, by the value of the closest nearest neighbour.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用作蒙版的栅格。</para>
        ///   <para>作为 NoData 的像元定义将被最近邻的值蚕食或替换的像元。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_outputName">
        /// <para>Output Name</para>
        /// <para><xdoc>
        ///   <para>The name of the output nibble raster service.</para>
        ///   <para>The default name is based on the tool name and the input layer name. If the layer name already exists, you will be prompted to provide another name.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输出半字节栅格服务的名称。</para>
        ///   <para>默认名称基于工具名称和输入图层名称。如果图层名称已存在，系统将提示您提供其他名称。</para>
        /// </xdoc></para>
        /// </param>
        public Nibble(object _inputRaster, object _inputMaskRaster, object _outputName)
        {
            this._inputRaster = _inputRaster;
            this._inputMaskRaster = _inputMaskRaster;
            this._outputName = _outputName;
        }
        public override string ToolboxName => "Raster Analysis Tools";

        public override string ToolName => "Nibble";

        public override string CallName => "ra.Nibble";

        public override List<string> AcceptEnvironments => ["cellSize", "extent", "mask", "outputCoordinateSystem", "snapRaster"];

        public override object[] ParameterInfo => [_inputRaster, _inputMaskRaster, _outputName, _nibbleValues.GetGPValue(), _nibbleNodata.GetGPValue(), _inputZoneRaster, _outputRaster];

        /// <summary>
        /// <para>Input Raster</para>
        /// <para><xdoc>
        ///   <para>The input raster that will be nibbled.</para>
        ///   <para>The raster can be either integer or floating point type.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将被蚕食的输入栅格。</para>
        ///   <para>栅格可以是整数类型，也可以是浮点类型。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _inputRaster { get; set; }


        /// <summary>
        /// <para>Input Mask Raster</para>
        /// <para><xdoc>
        ///   <para>The raster used as the mask.</para>
        ///   <para>The cells that are NoData define the cells that will be nibbled, or replaced, by the value of the closest nearest neighbour.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用作蒙版的栅格。</para>
        ///   <para>作为 NoData 的像元定义将被最近邻的值蚕食或替换的像元。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Mask Raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _inputMaskRaster { get; set; }


        /// <summary>
        /// <para>Output Name</para>
        /// <para><xdoc>
        ///   <para>The name of the output nibble raster service.</para>
        ///   <para>The default name is based on the tool name and the input layer name. If the layer name already exists, you will be prompted to provide another name.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输出半字节栅格服务的名称。</para>
        ///   <para>默认名称基于工具名称和输入图层名称。如果图层名称已存在，系统将提示您提供其他名称。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Name")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _outputName { get; set; }


        /// <summary>
        /// <para>Use NoData values if they are the nearest neighbor</para>
        /// <para><xdoc>
        ///   <para>Defines if NoData values in the input raster are allowed to nibble into the area defined by the mask raster.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—Specifies that the nearest neighbor value will be used whether it is NoData or another data value in the input raster. NoData values in the input raster are free to nibble into areas defined in the mask if they are the nearest neighbor. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—Specifies that only data values are free to nibble into areas defined in the mask raster. NoData values in the input raster are not allowed to nibble into areas defined in the mask raster even if they are the nearest neighbor.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>定义是否允许输入栅格中的 NoData 值啃食到掩膜栅格定义的区域。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 指定将使用最近的相邻值，无论该值是 NoData 还是输入栅格中的其他数据值。如果输入栅格中的 NoData 值是最近的相邻区域，则可以自由地啃食掩膜中定义的区域。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中 - 指定只有数据值可以自由地啃入掩模栅格中定义的区域。输入栅格中的 NoData 值不允许啃食掩码栅格中定义的区域，即使它们是最近的邻居。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Use NoData values if they are the nearest neighbor")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _nibbleValues_value _nibbleValues { get; set; } = _nibbleValues_value._true;

        public enum _nibbleValues_value
        {
            /// <summary>
            /// <para>ALL_VALUES</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("ALL_VALUES")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>DATA_ONLY</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("DATA_ONLY")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Nibble NoData cells</para>
        /// <para><xdoc>
        ///   <para>Defines if NoData cells in the input raster that are within the mask will remain NoData in the output raster.</para>
        ///   <bulletList>
        ///     <bullet_item>Unchecked—Specifies that NoData cells in the input raster and within the mask will remain NoData in the output. This is the default.</bullet_item><para/>
        ///     <bullet_item>Checked—Specifies that NoData cells in the input raster and within the mask can be nibbled into valid output cell values.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>定义输入栅格中位于掩膜内的 NoData 像元是否仍保留在输出栅格中的 NoData。</para>
        ///   <bulletList>
        ///     <bullet_item>未选中 - 指定输入栅格和掩膜内的 NoData 像元在输出中仍保留 NoData。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>选中 - 指定可以将输入栅格和掩膜内的 NoData 像元缩减为有效的输出像元值。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Nibble NoData cells")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _nibbleNodata_value _nibbleNodata { get; set; } = _nibbleNodata_value._false;

        public enum _nibbleNodata_value
        {
            /// <summary>
            /// <para>PROCESS_NODATA</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("PROCESS_NODATA")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>PRESERVE_NODATA</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("PRESERVE_NODATA")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Input Zone Raster</para>
        /// <para><xdoc>
        ///   <para>The input zone raster. For each zone, input cells that are within the mask will be replaced only by the nearest cell values within that same zone.</para>
        ///   <para>A zone is all the cells in a raster that have the same value, whether or not they are contiguous. The input zone layer defines the shape, values, and locations of the zones. The zone raster can be either integer or floating point type.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输入区域栅格。对于每个区域，掩码内的输入像元将仅替换为同一区域内最接近的像元值。</para>
        ///   <para>区域是栅格中具有相同值的所有像元，无论它们是否连续。输入区域图层用于定义区域的形状、值和位置。区域栅格可以是整数类型，也可以是浮点类型。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Zone Raster")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _inputZoneRaster { get; set; } = null;


        /// <summary>
        /// <para>Output Raster</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Raster")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _outputRaster { get; set; }


        public Nibble SetEnv(object cellSize = null, object extent = null, object mask = null, object outputCoordinateSystem = null, object snapRaster = null)
        {
            base.SetEnv(cellSize: cellSize, extent: extent, mask: mask, outputCoordinateSystem: outputCoordinateSystem, snapRaster: snapRaster);
            return this;
        }

    }

}